package com.xcity.pomelo.response;

import java.util.ArrayList;
import java.util.List;

import com.xcity.db.entity.Player;
import com.xcity.game.map.MineReport;

import naga.x.net.impl.pomelo.PomeloMessage;
import naga.x.net.impl.pomelo.protocol.Message;

@PomeloMessage(type = Message.Type.RESPONSE)
public class MineReportListResponse extends Response {
	
	private List<MineReportSimple> reportList;
	
	public static class MineReportSimple{
		public int type;//战报类型(0:掠夺目标失败 1:掠夺目标成功 2:被目标掠夺失败 3:被目标掠夺成功)
		public int mineType;//矿的类型(1~4 高级~低级矿)
		public String name;//目标名字
		public long tId;//目标ID(用于反击时请求ID)
		public long time;//战报创建时间
		public MineReportSimple(MineReport report){
			type = report.getReportType();
			mineType = report.getMineType();
			name = report.getTargetName();
			tId = report.getTargetId();
			time = report.getTime();
		}
	}
	public MineReportListResponse(int serial, Player player) {
		super(serial);
		reportList = new ArrayList<MineReportSimple>();
		List<MineReport> list = player.getMineReports().getReports();
		for(int i = 0, size = list.size(); i < size; i++){
			MineReport report = list.get(i);
			MineReportSimple reportSimple = new MineReportSimple(report);
			reportList.add(reportSimple);
		}
	}
	public List<MineReportSimple> getReportList() {
		return reportList;
	}
	public void setReportList(List<MineReportSimple> reportList) {
		this.reportList = reportList;
	}
}
